#version 450 core
in vec3 fragPos;
in vec3 normal;
out vec4 fragColor;
uniform vec3 viewPos;
uniform vec3 lightPos;
uniform vec3 lightColor;
void main() {
    vec3 objectColor = vec3(0.5, 0.8, 0.3);
    
    float ambientStrength = 0.3;
    vec3 ambient = ambientStrength * lightColor;

    vec3 lightDir = normalize(lightPos - fragPos);
    vec3 diffuse = max(dot(normal, lightDir), 0.0) * lightColor;
    
    float specularStrength = 0.5;
    vec3 viewDir = normalize(viewPos - fragPos);
    vec3 reflectDir = reflect(-lightDir, normal);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), 2);
    vec3 specular = specularStrength * spec * lightColor;

    fragColor = vec4((ambient + diffuse + specular) * objectColor, 1.0);
}